package com.zhuangjie.shop.controller;

import com.zhaungjie.base.conduit.R;
import com.zhuangjie.base.constant.ModuleSecurityNames;
import com.zhuangjie.security.annotations.OnlySystemCall;
import com.zhuangjie.security.annotations.PublicAPI;
import com.zhuangjie.shop.dto.ShopEvaluateDTO;
import com.zhuangjie.shop.service.ShopEvaluateService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * <p>
 * 店铺评价 前端控制器
 * </p>
 *
 * @author zhuangjie
 * @since 2024-04-25
 */
@RestController
@RequestMapping("/shop-evaluate")
public class ShopEvaluateController {
    @Autowired
    private ShopEvaluateService shopEvaluateService;

    @ApiOperation("子评价-评价提交到商家")
    @PublicAPI(modules = {ModuleSecurityNames.USER})
    @PostMapping("/submit")
    @OnlySystemCall
    public R submitShopEvaluate(@Valid @RequestBody ShopEvaluateDTO shopEvaluateDTO) {
        return R.capture(()->shopEvaluateService.submitShopEvaluate(shopEvaluateDTO));
    }
}
